﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reactive.Linq;
using System.Windows.Threading;

namespace SampleApp.Infrastructure
{
    public class DataRepository : IDisposable
    {
        private IObservable<IDataRow> _dataProvider;
        private List<IDisposable> _listReferences = new List<IDisposable>();

        public DataRepository(IObservable<IDataRow> dataProvider_)
        {
            _dataProvider = dataProvider_;
        }

        public IList<IDataRow> GetDataList()
        {
            //IDisposable listView = _dataProvider.Subscribe(
            return null;
        }

        ~DataRepository()
        {
            Dispose(false);
        }

        #region IDisposable implementation
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        protected void Dispose(bool disposing_)
        {
            _listReferences.ForEach(disposable => disposable.Dispose());
        }
    }
}
